package com.itheima.pxgl.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pxgl.annotation.AutoFill;
import com.itheima.pxgl.common.enumeration.OperationType;
import com.itheima.pxgl.entity.pojo.ApUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface loginMapper extends BaseMapper<ApUser> {
    /*
    根据用户名查找用户
     */
    @Select("select * from jw.ap_user where username = #{userVoName}")
    ApUser selectByName(String userVoName);

    @AutoFill(OperationType.INSERT)
    @Insert("insert into ap_user(salt, username, password, phone, image, sex, is_certification, is_identity_authentication, status, flag, created_time) " +
            "values (#{salt}, #{username}, #{password}, #{phone}, #{image},#{sex},#{isCertification},#{isIdentityAuthentication},#{status},#{flag},#{createdTime})")
    int insert(ApUser entity);
}
